<template>
  <div>
    首页
    <router-link :to="{ name: 'TodoList' }">去todoList页面</router-link>
    <div>
      <p v-for="todo in list" :key="todo.id">
        <el-tag type="success">
          <span>{{ todo.id }}-</span>
          <span>{{ todo.title }}</span>
        </el-tag>
      </p>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent, computed } from 'vue'
import { useStore } from 'vuex'

export default defineComponent({
  setup() {
    const store = useStore()
    const list = computed(() => store.state.todoList)
    return {
      list
    }
  }
})
</script>
